package com.okay.progress

import android.os.Bundle
import android.widget.Button
import androidx.fragment.app.FragmentActivity
import com.okay.testclass.R

/**
 * 横向进度条view
 */
class ProgressBarActivity : FragmentActivity() {

    var size:Float =0f

    private var proBar:ProgressBarView? =null
    private var buttonBar:Button?= null
    private var buttonBar1:Button?= null
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_progress_bar)
        proBar = findViewById(R.id.progress_bar)
        buttonBar = findViewById(R.id.button_bar)
        buttonBar1 = findViewById(R.id.button_bar1)
        buttonBar?.setOnClickListener{
            if(size>=100) return@setOnClickListener
            size+=1
            proBar?.setSize(size)
        }

        buttonBar1?.setOnClickListener{
            if(size<=0) return@setOnClickListener
            size-=1
            proBar?.setSize(size)
        }
    }
}